//
//  ZCollectionViewCell.m
//  OC-weibo
//
//  Created by zero on 17/4/4.
//  Copyright © 2017年 zero. All rights reserved.
//

#import "ZCollectionViewCell.h"

@interface ZCollectionViewCell()

//  展示图片
@property (nonatomic,weak)UIImageView *imgView;

@end

@implementation ZCollectionViewCell

#pragma mark
#pragma mark - 重写init方法
- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        //  布局
        [self setupUI];
    }
    
    return self;
}

#pragma mark
#pragma mark - 布局
- (void)setupUI{
    
    //  实例化
    UIImageView *imgView = [[UIImageView alloc] init];
    
    self.imgView = imgView;
    
    imgView.image = [UIImage imageNamed:@"avatar_default_big"];
    //  添加
    [self.contentView addSubview:imgView];
    
    //  约束
    [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.edges.equalTo(self.contentView);
    }];
    
}

#pragma mark
#pragma mark - 重写set方法
- (void)setModel:(NSDictionary *)model{
    
    _model = model;
    
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:model[@"thumbnail_pic"]] placeholderImage:[UIImage imageNamed:@"avatar_default_big"]];
}

@end
